home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / FROMUTS / UNIXLIB37B / test / c / ttytest < prev    next >
Text File  |  1992-02-10  |  742b  |  24 lines

  1. /* ttytest.c (c) Copyright 1990 H.Rogers */
  2.  
  3. /* This program tests the terminal I/O control routines. */
  4. /* For full information on termio, read the entry for the terminal
  5.  * device driver in section 4 of the UNIX Programmer's Manual. */
  6.  
  7. #include <stdio.h>            /* standard I/O */
  8.  
  9. #include "termio.h"            /* terminal I/O */
  10. #include "unistd.h"            /* UNIX system calls */
  11.  
  12. int main()
  13. {
  14. struct termio t[1];            /* terminal I/O control structure */
  15.  
  16. setvbuf(stdout,0,_IONBF,BUFSIZ);    /* unbuffer stdout */
  17. ioctl(0,TCGETA,t);            /* get terminal I/O control */
  18. t->c_lflag &= (~(ICANON|ECHO));
  19. t->c_cc[VMIN] = 1;
  20. t->c_cc[VTIME] = 0;
  21. ioctl(0,TCSETA,t);            /* set terminal I/O control */
  22. while (-1) printf(" %02X ",getchar());    /* hex dump keyboard input */
  23. }
  24.